.\" Copyright 1995 Yggdrasil Computing, Incorporated.
.\" and Copyright 2015 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH DLERROR 3 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
dlerror \- obtain error diagnostic for functions in the dlopen API
.SH SYNOPSIS
.nf
.B #include <dlfcn.h>
.PP
.B "char *dlerror(void);"
.PP
Link with \fI\-ldl\fP.
.fi
.SH DESCRIPTION
The
.BR dlerror ()
function returns a human-readable,
null-terminated string describing the most recent error
that occurred from a call to one of the functions in the dlopen API
since the last call to
.BR dlerror ().
The returned string does
.I not
include a trailing newline.
.PP
.BR dlerror ()
returns NULL if no errors have occurred since initialization or since
it was last called.
.SH VERSIONS
.BR dlerror ()
is present in glibc 2.0 and later.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbx lb lb
l l l.
Interface	Attribute	Value
T{
.BR dlerror ()
T}	Thread safety	MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
POSIX.1-2001.
.SH NOTES
The message returned by
.BR dlerror ()
may reside in a statically allocated buffer that is
overwritten by subsequent
.BR dlerror ()
calls.
.\" .LP
.\" The string returned by
.\" .BR dlerror ()
.\" should not be modified.
.\" Some systems give the prototype as
.\" .sp
.\" .in +5
.\" .B "const char *dlerror(void);"
.\" .in
.SS History
This function is part of the dlopen API, derived from SunOS.
.SH EXAMPLES
See
.BR dlopen (3).
.SH SEE ALSO
.BR dladdr (3),
.BR dlinfo (3),
.BR dlopen (3),
.BR dlsym (3)
.SH COLOPHON
This page is part of release 5.13 of the Linux
.I man-pages
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
\%https://www.kernel.org/doc/man\-pages/.
